home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / pmw123.zip / PMODEW.DOC < prev    next >
Text File  |  1996-06-24  |  72KB  |  2,059 lines

  1. ------------------------------------------------------------------------------
  2. ---------------------- PMODE For Watcom C/C++ - v1.23 ------------------------
  3. ------------------------------------------------------------------------------
  4.  
  5.   This is the documentation for PMODE for Watcom C/C++ - v1.23, henceforth
  6. referred to as PMODE/W. PMODE/W is Copyright (c) 1994-1996, Charles Scheffold
  7. and Thomas Pytel. All rights reserved.
  8.  
  9. Contents:
  10. ---------
  11.  
  12. 1 - Overview
  13.     1.0  - Legal disclaimer
  14.     1.1  - Description
  15.     1.2  - Usage
  16.     1.3  - Performance and compatibility
  17.     1.4  - PMODE/W protected mode
  18.     1.5  - PMODE/W execution
  19.     1.6  - Terms for non-commercial use
  20.     1.7  - Licensing PMODE/W for commercial use
  21.     1.8  - Contact information
  22.  
  23. 2 - Supported DPMI INT 31h functions
  24.     2.0  - Function 0000h - Allocate Descriptors
  25.     2.1  - Function 0001h - Free Descriptor
  26.     2.2  - Function 0003h - Get Selector Increment Value
  27.     2.3  - Function 0006h - Get Segment Base Address
  28.     2.4  - Function 0007h - Set Segment Base Address
  29.     2.5  - Function 0008h - Set Segment Limit
  30.     2.6  - Function 0009h - Set Descriptor Access Rights
  31.     2.7  - Function 000Ah - Create Alias Descriptor
  32.     2.8  - Function 000Bh - Get Descriptor
  33.     2.9  - Function 000Ch - Set Descriptor
  34.     2.10 - Function 0100h - Allocate DOS Memory Block
  35.     2.11 - Function 0101h - Free DOS Memory Block
  36.     2.12 - Function 0102h - Resize DOS Memory Block
  37.     2.13 - Function 0200h - Get Real Mode Interrupt Vector
  38.     2.14 - Function 0201h - Set Real Mode Interrupt Vector
  39.     2.15 - Function 0204h - Get Protected Mode Interrupt Vector
  40.     2.16 - Function 0205h - Set Protected Mode Interrupt Vector
  41.     2.17 - Function 0300h - Simulate Real Mode Interrupt
  42.     2.18 - Function 0301h - Call Real Mode Procedure With Far Return Frame
  43.     2.19 - Function 0302h - Call Real Mode Procedure With IRET Frame
  44.     2.20 - Function 0303h - Allocate Real Mode Callback Address
  45.     2.21 - Function 0304h - Free Real Mode Callback Address
  46.     2.22 - Function 0305h - Get State Save/Restore Addresses
  47.     2.23 - Function 0306h - Get Raw Mode Switch Addresses
  48.     2.24 - Function 0400h - Get Version
  49.     2.25 - Function 0500h - Get Free Memory Information
  50.     2.26 - Function 0501h - Allocate Memory Block
  51.     2.27 - Function 0502h - Free Memory Block
  52.     2.28 - Function 0503h - Resize Memory Block
  53.     2.29 - Function 0800h - Physical Address Mapping
  54.     2.30 - Function 0801h - Free Physical Address Mapping
  55.     2.31 - Function 0900h - Get and Disable Virtual Interrupt State
  56.     2.32 - Function 0901h - Get and Enable Virtual Interrupt State
  57.     2.33 - Function 0902h - Get Virtual Interrupt State
  58.     2.34 - Function EEFFh - Get DOS Extender Information
  59.  
  60. 3 - Supported DOS extended INT 21h functions
  61.     3.0  - Function 09h - Write String to Standard Output
  62.     3.1  - Function 1Ah - Set Disk Transfer Area
  63.     3.2  - Function 1Bh - Get Allocation Information for Default Drive
  64.     3.3  - Function 1Ch - Get Allocation Information for Specific Drive
  65.     3.4  - Function 1Fh - Get Drive Parameter Block for Default Drive
  66.     3.5  - Function 25h - Set Interrupt Vector
  67.     3.6  - Function 2Fh - Get Disk Transfer Area
  68.     3.7  - Function 32h - Get Drive Parameter Block for Specific Drive
  69.     3.8  - Function 34h - Get Address of InDOS Flag
  70.     3.9  - Function 35h - Get Interrupt Vector
  71.     3.10 - Function 39h - Create Subdirectory
  72.     3.11 - Function 3Ah - Remove Subdirectory
  73.     3.12 - Function 3Bh - Set Directory
  74.     3.13 - Function 3Ch - Create File
  75.     3.14 - Function 3Dh - Open File
  76.     3.15 - Function 3Fh - Read From File
  77.     3.16 - Function 40h - Write to File
  78.     3.17 - Function 41h - Delete File
  79.     3.18 - Function 43h - Get/Set File Attributes
  80.     3.19 - Function 47h - Get Directory Path
  81.     3.20 - Function 48h - Allocate Memory Block
  82.     3.21 - Function 49h - Free Memory Block
  83.     3.22 - Function 4Ah - Resize Memory Block
  84.     3.23 - Function 4Bh - Sub-Function 00h - Load and Execute Program
  85.     3.24 - Function 4Eh - Search for First Filename Match
  86.     3.25 - Function 4Fh - Search for Next Filename Match
  87.     3.26 - Function 56h - Rename File
  88.  
  89. 4 - Supported mouse extended INT 33h functions
  90.     4.0  - Function 0009h - Define Graphics Cursor
  91.     4.1  - Function 000Ch - Define Interrupt Subroutine Parameters
  92.     4.2  - Function 0016h - Save Driver State
  93.     4.3  - Function 0017h - Restore Driver State
  94.  
  95. ------------------------------------------------------------------------------
  96. ------------------------------ 1 - Overview ----------------------------------
  97. ------------------------------------------------------------------------------
  98.  
  99.   This section will give you all the information you will need to plug PMODE/W
  100. right into your Watcom C/C++ protected mode programs. All of the other things
  101. you need to be aware of about using PMODE/W commercially and non-commercially
  102. are also in this section. Specific information on INT 31h and INT 21h DOS
  103. extended services supported by PMODE/W is in the following sections. Please
  104. note that we have only tested this extender with Watcom C/C++ versions 9.5 and
  105. 10.0.
  106.  
  107. 1.0 - Legal disclaimer:
  108. -----------------------
  109.  
  110.   We exclude any and all implied warranties, including warranties of
  111. merchantability and fitness for a particular purpose. We make no warranty or
  112. representation, either express or implied, with respect to PMODE/W, its
  113. quality, performance, merchantability, or fitness for a particular purpose.
  114. We shall have no liability for special, incidental, or consequential damages
  115. arising out of or resulting from the use, misuse, or modification of PMODE/W.
  116.  
  117.   All trademarks used in this documentation are property of their respective
  118. owners.
  119.  
  120. 1.1 - Description:
  121. ------------------
  122.  
  123.   PMODE/W is basically a direct replacement for DOS/4GW, the default extender
  124. for Watcom C/C++. PMODE/W itself is confined within a single small EXE file.
  125. This EXE file is what you make your stub at link time, replacing the DOS/4GW
  126. stub which searches the path for DOS/4GW and re-executes it on the original
  127. program. Programs linked with the PMODE/W extender do not need any big, bulky
  128. external program to execute. In addition, programs linked with PMODE/W may be
  129. compressed, and then decompressed at run-time by PMODE/W. When a PMODE/W
  130. program is executed, the extender within the EXE does all the setup necessary
  131. and runs the protected mode portion of that EXE. A nice feature of PMODE/W
  132. programs is that you can always run them with DOS/4GW if you wish (unless the
  133. PMODE/W program is compressed). Executing DOS/4GW on a PMODE/W program will
  134. cause the PMODE/W extender in the EXE to be ignored and DOS/4GW will just run
  135. the protected mode portion of the program itself. This also means you can
  136. debug PMODE/W programs just as easily by using the debugger that is part of
  137. the Watcom C/C++ package.
  138.  
  139.   All in all, PMODE/W gives you a great deal of flexibility. You may do all of
  140. your development with PMODE/W, but if you are unsatisfied with the performance
  141. or with any other aspect of PMODE/W, you may switch back to DOS/4GW at any
  142. time quite easily. This also applies the other way around: do all of your
  143. development with DOS/4GW, then for the release version use PMODE/W. There are
  144. other extenders available for Watcom C/C++ and they do provide a lot more
  145. 'stuff', but they do not approach PMODE/W in terms of speed and size.
  146.  
  147.   To be fair, we must note the disadvantages of PMODE/W. It does lack that
  148. 'stuff' which the other more professional extenders posess. The good point
  149. being it also lacks the overhead of supporting that 'stuff'. For example,
  150. PMODE/W does absolutely no exception trapping whatsoever. This is purely an
  151. ideological thing. We do not wish to slow down the IRQ process in ANY way at
  152. all. We know (since we do a lot of it) that there are applications where the
  153. lowest possible interrupt latency is required. Exception handlers would force
  154. us to slow down IRQ response (reprogramming the PICs is out of the question).
  155. However, this is not a major loss as you should not be getting exceptions in a
  156. release version of a program anyway. During development you can always run
  157. DOS/4GW on your code to provide exception trapping.
  158.  
  159.   To sum it up, if you are looking for a good solid, stable, and fast
  160. extender, you need look no further. If frills are what you want, PMODE/W may
  161. not be the best choice for you.
  162.  
  163. Here are the advantages of PMODE/W:
  164.  
  165. ) No external extender required (everything needed to execute is in the EXE).
  166. ) Small size (less than 10k for the entire extender program).
  167. ) Compression of protected mode executables.
  168. ) Low extended memory overhead.
  169. ) Does not require ANY extended memory to load OR execute.
  170. ) No annoying initialization messages.
  171. ) Fast execution time.
  172. ) Free for non-commercial use.
  173.  
  174. 1.2 - Usage:
  175. ------------
  176.  
  177.   The following main files should be present in your PMODE/W archive (probably
  178. among various BBS ads and other junk):
  179.  
  180. ) FILE_ID.DIZ   - BBS description file.
  181. ) UPDATES.DOC   - Information about updates/bug fixes.
  182. ) PMODEW.DOC    - The documentation you are now reading.
  183. ) PMODEW.EXE    - The actual PMODE/W DOS extender.
  184. ) PMODEW.FAQ    - Frequently asked questions.
  185. ) PMODEW.LNK    - Example linker initialization file for PMODE/W.
  186. ) PMWSETUP.EXE  - PMODE/W parameter setup utility.
  187. ) PMWBIND.EXE   - PMODE/W bind utility.
  188. ) PMWLITE.EXE   - PMODE/W protected mode executable compression utility.
  189. ) PMWVER.COM    - PMODE/W version check utility.
  190. ) UTILS.DOC     - Documentation on PMWSETUP, PMWBIND, PMWLITE, and PMWVER.
  191. ) EXAMPLES.ZIP  - Example files.
  192.  
  193.   You will probably want to add a new system, PMODE/W, to your WLSYSTEM.LNK
  194. file. All you need to do in this case is add the contents of PMODEW.LNK to
  195. your WLSYSTEM.LNK file, this will add the system 'pmodew' to your Watcom C/C++
  196. setup. You may also just compile to a 'dos4g' system but replace the stub with
  197. PMODEW.EXE.
  198.  
  199. 1.3 - Performance and compatibility:
  200. ------------------------------------
  201.  
  202.   Our major concerns in developing PMODE/W were speed, size, and stability.
  203. PMODE/W itself was written entirely in assembly (unlike some extenders we
  204. know). When running under PMODE/W your code will be running at a privilege
  205. level of zero, the highest and fastest. PMODE/W does not virtualize anything,
  206. and does not invoke any protected mode mechanism that is slow. For example,
  207. if the system is running clean or under XMS, PMODE/W does not turn on paging.
  208. Under a memory manager which provides both VCPI and DPMI services, PMODE/W
  209. will opt for VCPI protected mode which is significantly faster than DPMI. When
  210. PMODE/W makes calls to real mode, it switches the system into actual real mode
  211. rather than the slower V86 mode (when it can, under VCPI this is not possible,
  212. control must be passed back to the VCPI server). In terms of speed, when your
  213. code is running under PMODE/W, it is running as fast as the system will allow.
  214.  
  215.   In terms of size on disk, we need say no more than for you to look at the
  216. size of the PMODE/W executable and compare it to that other extender. In terms
  217. of memory size, you may do tests yourself to confirm that PMODE/W does indeed
  218. suck up a lot less memory at run-time than the competition (though probably a
  219. little bit more low memory). In fact, PMODE/W will run even if there is
  220. absolutely no extended memory in the system (assuming of course there is
  221. enough low memory for the program). To be fair, we must say we squished the
  222. PMODE/W executable with our own compression program written expressly for the
  223. purpose (this demonstrates the extent we took most of our optimizations to).
  224.  
  225.   As for compatibility, PMODE/W is almost fully compatible with DOS/4GW as far
  226. as Watcom C/C++ is concerned. PMODE/W extends only those DOS functions
  227. required by the Watcom C/C++ libraries (though this is a good deal of them).
  228. The exception is BIOS INT 13h functions, which PMODE/W does not extend.
  229. PMODE/W also provides a subset of DPMI 0.9 INT 31h functions in protected
  230. mode. We do not emulate DOS/4GW though, as none of its API functions are
  231. duplicated by PMODE/W. PMODE/W will run under a clean system, XMS, VCPI, or
  232. DPMI. Though you should be aware that under a DPMI system, PMODE/W will not be
  233. providing the DPMI functions, but rather the actual DPMI host in the system
  234. will. You should also be aware that PMODE/W will leave the A20 line enabled
  235. when calling real mode. Disabling the A20 for real mode is not really
  236. necessary, it is a big slowdown during mode switches to have to enable/disable
  237. the A20, so PMODE/W avoids it.
  238.  
  239. 1.4 - PMODE/W protected mode:
  240. -----------------------------
  241.  
  242.   When run under a clean system, XMS, or VCPI, PMODE/W has control of
  243. protected mode. In this case, it can set up the system to run as fast as
  244. possible under the various conditions. Under DPMI, the DPMI host of the system
  245. will have full protected mode control and PMODE/W will install its DOS
  246. extensions on top of that. If the system provides both VCPI and DPMI services,
  247. PMODE/W will use the VCPI services for faster execution (unless instructed not
  248. to by the setup program). When PMODE/W does have protected mode control (under
  249. clean/XMS/VCPI), it runs all code at a privilege level of zero. In addition,
  250. under a clean or XMS system, paging will not be enabled. This is only a minor
  251. speed increase, but there is no real need to manage paging.
  252.  
  253.   PMODE/W provides a subset of DPMI 0.9 function calls and general
  254. functionality when a DPMI host is not present. PMODE/W will pass any software
  255. interrupts from protected mode to their default real mode handlers (provided
  256. no protected mode handlers have been installed for them), just as DPMI will.
  257. The general registers will be passed on to the real mode handler, but the
  258. segment registers can not be as they have different meanings in real mode and
  259. protected mode. The flags will be passed back from the real mode handler. This
  260. provides a simple interface to all real mode interrupt routines which do not
  261. take parameters in the segment registers, for example, INT 16h function 00h.
  262.  
  263.   Any IRQs that occur in protected mode and have not been hooked by a
  264. protected mode handler will be sent on to their real mode handlers. If an IRQ
  265. occurs in real mode, and a protected mode handler has hooked that IRQ, it will
  266. be sent to the protected mode handler first. The protected mode handler may
  267. chain to the real mode handler for that IRQ by calling the previous protected
  268. mode handler for that IRQ. This behavior is in accordance with the DPMI
  269. standard. If you hook a protected mode IRQ (INT 31h function 0205h), then hook
  270. the same IRQ in real mode (INT 31h function 0201h), the protected mode handler
  271. will be called if the IRQ occurs in protected mode, and the real mode handler
  272. will handle the IRQs if they occur in real mode. Setting up two handlers like
  273. this assures minimal latency. This means a handler will get control when the
  274. IRQ occurs as soon as physically possible.
  275.  
  276.   In accordance with DPMI specifications, PMODE/W will pass up software
  277. interrupts 1ch (BIOS timer tick), 23h (DOS CTRL+C), and 24h (DOS critical
  278. error) from real mode to protected mode. This means that those interrupts can
  279. be hooked directly in protected mode without having to set up a callback
  280. mechanism yourself. PMODE/W will also pass interrupt 1bh (BIOS CTRL+BREAK)
  281. from real mode up to protected mode. This is not a DPMI requirement, but it is
  282. necessary for the sake of compatibility with DOS/4GW.
  283.  
  284.   Another departure by PMODE/W from official DPMI specifications is in
  285. extended memory allocation. DPMI documentation states that the block of
  286. extended memory allocated through function 0501h is guaranteed at least
  287. paragraph alignment. The PMODE/W DPMI implementation will enforce only DWORD
  288. alignment.
  289.  
  290. 1.5 - PMODE/W execution:
  291. ------------------------
  292.  
  293.   When a PMODE/W executable is run, PMODE/W will attempt to switch the system
  294. into protected mode and load the protected mode portion of the same
  295. executable. If there is some error, not enough memory, or a system
  296. incompatibility, PMODE/W will exit with an error message. If loading was
  297. successful, PMODE/W will pass execution control on to the program. PMODE/W
  298. will load any 16bit code and data into low memory, but 32bit code and data may
  299. be loaded into low or extended memory depending on avaliability.
  300.  
  301.   There are a number of modifiable parameters in the PMODE/W extender
  302. executable that affect protected mode execution. For the most part, these
  303. parameters deal with memory. PMODE/W allocates one large block of extended
  304. memory for its pool from which it provides memory to its client program. There
  305. is a maximum value for the extended memory to be allocated. By default, the
  306. maximum is all of the extended memory in the system. The maximum value
  307. reflects the size of the block you want PMODE/W to take from the system, not
  308. necessarily the size of the largest block available to the default C/C++
  309. malloc functions. You may set the maximum to zero to indicate you do not want
  310. PMODE/W to allocate ANY extended memory.
  311.  
  312.   Another variable specifies the amount of low memory for PMODE/W to TRY to
  313. keep free. If PMODE/W can, it will accommodate this value by loading 32bit
  314. code and data into extended memory. If there is not enough extended memory
  315. available for this, 32bit code and data will be loaded into low memory anyway.
  316. If PMODE/W can not keep this much low memory free, it will not exit with an
  317. error message. Setting this parameter to a high value will in effect duplicate
  318. the DOS/4GW behavior of loading all 32bit code and data into extended memory.
  319. If you do not necessarily need any extra low memory free during the execution
  320. of your program, you may set this value to zero.
  321.  
  322.   There is a group of parameters that specify the number and size of nested
  323. mode switch stacks. Whenever you do a call to real mode, or a callback or IRQ
  324. is passed from real mode to its routine in protected mode, a nested stack is
  325. used. These parameters have meaning only if the program is not run under a
  326. DPMI system. If a DPMI host is in place when the program is run, it provides
  327. its own nested stacks for mode switches. The number of nested stacks directly
  328. affects the number of nested mode switches your program can do using the
  329. various mode switch methods. The size of both the real mode and protected mode
  330. nested stacks can also be specified. By default, these values are high enough
  331. for normal operation. However, if you intend to use a lot of stack variables
  332. in a protected mode IRQ handler, or a lot of recursive calls, you may need to
  333. increase the size of the protected mode nested stacks. The more nested stacks
  334. you specify and the larger they are, the more low memory is needed by PMODE/W
  335. during execution.
  336.  
  337.   Another group of variables that has meaning only under clean/XMS/VCPI
  338. execution specify the number of selectors and DPMI callbacks you want PMODE/W
  339. to make available. The more selectors and callbacks you want, the more low
  340. memory is used by PMODE/W, though the amount of low memory used for each is
  341. quite low so that large numbers of each can be specified. There will usually
  342. be a little less than the number of selectors and callbacks you request
  343. available to your program due to the protected mode system and C/C++ code
  344. using some of them. For this reason you should request 20h-40h more selectors
  345. and 2-4 more callbacks than you will need in your program.
  346.  
  347.   There are three other miscellaneous parameters that can be set. There is a
  348. maximum number of page tables to use under a VCPI system. Each page table
  349. allocated requires 4k of low memory to be used by PMODE/W and maps 4M of
  350. memory. This directly affects the maximum amount of extended memory available
  351. under a VCPI system. This parameter is only the maximum number of page tables
  352. to allow. At run-time, only as many page tables will be allocated as are
  353. needed. Under a clean/XMS system, no page tables are required, so this
  354. parameter has no meaning. But under VCPI, you may want to restrict the number
  355. of page tables to save low memory if you do not need more than a certain
  356. amount of extended memory. This puts a maximum ceiling on extended memory
  357. under VCPI which may be lower than the maximum actually specified in the other
  358. variable. The second parameter specifies the order of DPMI and VCPI detection.
  359. By default, VCPI will be checked before DPMI, but you may set DPMI to be
  360. checked before VCPI so that under a system which supports both VCPI and DPMI,
  361. DPMI will be used. The third variable specifies how many pages to reserve for
  362. physical address mapping calls (INT 31h function 0800h) under VCPI. Under XMS
  363. or a raw system paging is not enabled, and PMODE/W does not need pages for
  364. physical address mapping. Each page will allow you to map up to 4M of address
  365. space and takes up 4k of extended memory. So for example, if you intend to map
  366. a 2M frame buffer of a video card, you will need only one page. You may set
  367. this parameter to zero if you do not intend to map any physical addresses.
  368.  
  369. 1.6 - Terms for non-commercial use:
  370. -----------------------------------
  371.  
  372.   You are hereby permitted to use this DOS extender in any and all
  373. non-commercial and non-shareware software programs free of any financial
  374. obligation to us, provided that if the program is distributed, it is
  375. distributed to the public, free of any charge for the program itself. There is
  376. no restriction on what kind of reselling of the above mentioned program is
  377. done (shareware houses, CD-ROMs, etc...), as long as the program is available
  378. to the public with no financial obligation to the author(s). The only thing we
  379. ask in this case is that you credit us in your production for the DOS
  380. extender. It would also be nice, but not necessary, if you dropped us a note
  381. informing us of your use of PMODE/W in some production.
  382.  
  383. 1.7 - Licensing PMODE/W for commercial use:
  384. -------------------------------------------
  385.  
  386.   If you wish to use PMODE/W in a commercial, shareware, or any program which
  387. is to be sold or has attached to it an obligation to buy something, you MUST
  388. purchase a commercial distribution license. This license will allow royalty
  389. free distribution of any and all applications using PMODE/W created and owned
  390. by the holder of the license. A separate license is NOT required for each
  391. application in which PMODE/W is used. This license is non-transferrable (you
  392. cannot sell, give, loan, or otherwise transfer it to someone else).
  393.  
  394.   The license fee is $500 U.S. for commercial or shareware programs. Once
  395. purchased, this license is valid for any and all programs created and owned by
  396. the person or company purchasing the license until the end of time. The
  397. license is a one time fee, with no restrictions on how many programs PMODE/W
  398. can be used in. There is a special discount available to students on PMODE/W.
  399. The license can be purchased by university students for $100 U.S.
  400.  
  401. 1.8 - Contact information:
  402. --------------------------
  403.  
  404.   If you are interested in licensing PMODE/W for a commercial or shareware
  405. program, you may contact us in the following manner:
  406.  
  407. ) Send mail to:
  408.  
  409.     Ryan Cramer
  410.     8300 Riding Ridge Place
  411.     McLean, VA  22102
  412.     USA
  413.  
  414. ) Send E-mail to:
  415.  
  416.     rcramer1@osf1.gmu.edu
  417.  
  418. ) On the World Wide Web:
  419.  
  420.     http://www.dorsai.org/~daredevi/pmw
  421.  
  422. ) Drop a note to the sysop on the Data Connection BBS at:
  423.  
  424.     +1-703-506-8598
  425.     +1-703-847-0861
  426.  
  427. ) For technical questions, drop a note to the following address:
  428.  
  429.     daredevi@dorsai.org
  430.  
  431. ------------------------------------------------------------------------------
  432. ------------------- 2 - Supported DPMI INT 31h functions ---------------------
  433. ------------------------------------------------------------------------------
  434.  
  435.   PMODE/W duplicates a subset of DPMI protected mode functions. These
  436. functions are available ONLY in protected through INT 31h. They provide
  437. descriptor services, extended memory services, interrupt services, translation
  438. services, and some other miscellaneous things. A function is called by setting
  439. AX to the function code, setting any other registers for the function, and
  440. executing INT 31h. Upon return, the carry flag will be clear if the function
  441. was successful. If the carry flag is set, the function failed. All other
  442. registers are preserved unless otherwise specified. In addition to the
  443. functions listed here, functions 0600h, 0601h, 0702h, and 0703h will return
  444. with the carry flag clear to stay compatible with code that uses those
  445. particular DPMI functions.
  446.  
  447. 2.0 - Function 0000h - Allocate Descriptors:
  448. --------------------------------------------
  449.  
  450.   Allocates one or more descriptors in the client's descriptor table. The
  451. descriptor(s) allocated must be initialized by the application with other
  452. function calls.
  453.  
  454. In:
  455.   AX     = 0000h
  456.   CX     = number of descriptors to allocate
  457.  
  458. Out:
  459.   if successful:
  460.     carry flag clear
  461.     AX       = base selector
  462.  
  463.   if failed:
  464.     carry flag set
  465.  
  466. Notes:
  467. ) If more that one descriptor was requested, the function returns a base
  468.   selector referencing the first of a contiguous array of descriptors. The
  469.   selector values for subsequent descriptors in the array can be calculated
  470.   by adding the value returned by INT 31h function 0003h.
  471.  
  472. ) The allocated descriptor(s) will be set to expand-up writeable data, with
  473.   the present bit set and a base and limit of zero. The privilege level of the
  474.   descriptor(s) will match the client's code segment privilege level.
  475.  
  476. 2.1 - Function 0001h - Free Descriptor:
  477. ---------------------------------------
  478.  
  479.   Frees a descriptor.
  480.  
  481. In:
  482.   AX     = 0001h
  483.   BX     = selector for the descriptor to free
  484.  
  485. Out:
  486.   if successful:
  487.     carry flag clear
  488.  
  489.   if failed:
  490.     carry flag set
  491.  
  492. Notes:
  493. ) Each descriptor allocated with INT 31h function 0000h must be freed
  494.   individually with the function. Even if it was previously allocated as part
  495.   of a contiguous array of descriptors.
  496.  
  497. ) Under DPMI 1.0/VCPI/XMS/raw, any segment registers which contain the
  498.   selector being freed are zeroed by this function.
  499.  
  500. 2.2 - Function 0003h - Get Selector Increment Value:
  501. ----------------------------------------------------
  502.  
  503.   The Allocate Descriptors function (0000h) can allocate an array of
  504. contiguous descriptors, but only return a selector for the first descriptor.
  505. The value returned by this function can be used to calculate the selectors for
  506. subsequent descriptors in the array.
  507.  
  508. In:
  509.   AX     = 0003h
  510.  
  511. Out:
  512.   always successful:
  513.     carry flag clear
  514.     AX       = selector increment value
  515.  
  516. Notes:
  517. ) The increment value is always a power of two.
  518.  
  519. 2.3 - Function 0006h - Get Segment Base Address:
  520. ------------------------------------------------
  521.  
  522.   Returns the 32bit linear base address from the descriptor table for the
  523. specified segment.
  524.  
  525. In:
  526.   AX     = 0006h
  527.   BX     = selector
  528.  
  529. Out:
  530.   if successful:
  531.     carry flag clear
  532.     CX:DX  = 32bit linear base address of segment
  533.  
  534.   if failed:
  535.     carry flag set
  536.  
  537. Notes:
  538. ) Client programs must use the LSL instruction to query the limit for a
  539.   descriptor.
  540.  
  541. 2.4 - Function 0007h - Set Segment Base Address:
  542. ------------------------------------------------
  543.  
  544.   Sets the 32bit linear base address field in the descriptor for the specified
  545. segment.
  546.  
  547. In:
  548.   AX     = 0007h
  549.   BX     = selector
  550.   CX:DX  = 32bit linear base address of segment
  551.  
  552. Out:
  553.   if successful:
  554.     carry flag clear
  555.  
  556.   if failed:
  557.     carry flag set
  558.  
  559. Notes:
  560. ) Under DPMI 1.0/VCPI/XMS/raw, any segment register which contains the
  561.   selector specified in register BX will be reloaded. DPMI 0.9 may do this,
  562.   but it is not guaranteed.
  563.  
  564. ) We hope you have enough sense not to try to modify your current CS or SS
  565.   descriptor.
  566.  
  567. 2.5 - Function 0008h - Set Segment Limit:
  568. -----------------------------------------
  569.  
  570.   Sets the limit field in the descriptor for the specified segment.
  571.  
  572. In:
  573.   AX     = 0008h
  574.   BX     = selector
  575.   CX:DX  = 32bit segment limit
  576.  
  577. Out:
  578.   if successful:
  579.     carry flag clear
  580.  
  581.   if failed:
  582.     carry flag set
  583.  
  584. Notes:
  585. ) The value supplied to the function in CX:DX is the byte length of the
  586.   segment-1.
  587.  
  588. ) Segment limits greater than or equal to 1M must be page aligned. That is,
  589.   they must have the low 12 bits set.
  590.  
  591. ) This function has an implicit effect on the "G" bit in the segment's
  592.   descriptor.
  593.  
  594. ) Client programs must use the LSL instruction to query the limit for a
  595.   descriptor.
  596.  
  597. ) Under DPMI 1.0/VCPI/XMS/raw, any segment register which contains the
  598.   selector specified in register BX will be reloaded. DPMI 0.9 may do this,
  599.   but it is not guaranteed.
  600.  
  601. ) We hope you have enough sense not to try to modify your current CS or SS
  602.   descriptor.
  603.  
  604. 2.6 - Function 0009h - Set Descriptor Access Rights:
  605. ----------------------------------------------------
  606.  
  607.   Modifies the access rights field in the descriptor for the specified
  608. segment.
  609.  
  610. In:
  611.   AX     = 0009h
  612.   BX     = selector
  613.   CX     = access rights/type word
  614.  
  615. Out:
  616.   if successful:
  617.     carry flag clear
  618.  
  619.   if failed:
  620.     carry flag set
  621.  
  622. Notes:
  623. ) The access rights/type word passed to the function in CX has the following
  624.   format:
  625.  
  626.     Bit: 15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  627.        +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  628.        | G |B/D| 0 | ? |       ?       | 1 |  DPL  | 1 |C/D|E/C|W/R| A |
  629.        +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  630.  
  631.     G   - 0=byte granular, 1=page granular
  632.     B/D - 0=default 16bit, 1=default 32bit
  633.     DPL - must be equal to caller's CPL
  634.     C/D - 0=data, 1=code
  635.     E/C - data: 0=expand-up, 1=expand-down
  636.           code: must be 0 (non-conforming)
  637.     W/R - data: 0=read, 1=read/write
  638.           code: must be 1 (readable)
  639.     A   - 0=not accessed, 1=accessed
  640.     0   - must be 0
  641.     1   - must be 1
  642.     ?   - ignored
  643.  
  644. ) Client programs should use the LAR instruction to examine the access rights
  645.   of a descriptor.
  646.  
  647. ) Under DPMI 1.0/VCPI/XMS/raw, any segment register which contains the
  648.   selector specified in register BX will be reloaded. DPMI 0.9 may do this,
  649.   but it is not guaranteed.
  650.  
  651. ) We hope you have enough sense not to try to modify your current CS or SS
  652.   descriptor.
  653.  
  654. 2.7 - Function 000Ah - Create Alias Descriptor:
  655. -----------------------------------------------
  656.  
  657.   Creates a new data descriptor that has the same base and limit as the
  658. specified descriptor.
  659.  
  660. In:
  661.   AX     = 000ah
  662.   BX     = selector
  663.  
  664. Out:
  665.   if successful:
  666.     carry flag clear
  667.     AX       = data selector (alias)
  668.  
  669.   if failed:
  670.     carry flag set
  671.  
  672. Notes:
  673. ) The selector supplied to the function may be either a data descriptor or
  674.   a code descriptor. The alias descriptor created is always an expand-up
  675.   writeable data segment.
  676.  
  677. ) The descriptor alias returned by this function will not track changes to the
  678.   original descriptor.
  679.  
  680. 2.8 - Function 000Bh - Get Descriptor:
  681. --------------------------------------
  682.  
  683.   Copies the descriptor table entry for the specified selector into an 8 byte
  684. buffer.
  685.  
  686. In:
  687.   AX     = 000bh
  688.   BX     = selector
  689.   ES:EDI = selector:offset of 8 byte buffer
  690.  
  691. Out:
  692.   if successful:
  693.     carry flag clear
  694.     buffer pointed to by ES:EDI contains descriptor
  695.  
  696.   if failed:
  697.     carry flag set
  698.  
  699. 2.9 - Function 000Ch - Set Descriptor:
  700. --------------------------------------
  701.  
  702.   Copies the contents of an 8 byte buffer into the descriptor for the
  703. specified selector.
  704.  
  705. In:
  706.   AX     = 000ch
  707.   BX     = selector
  708.   ES:EDI = selector:offset of 8 byte buffer containing descriptor
  709.  
  710. Out:
  711.   if successful:
  712.     carry flag clear
  713.  
  714.   if failed:
  715.     carry flag set
  716.  
  717. ) The descriptors access rights/type word at offset 5 within the descriptor
  718.   follows the same format and restrictions as the access rights/type parameter
  719.   CX to the Set Descriptor Access Rights function (0009h).
  720.  
  721. ) Under DPMI 1.0/VCPI/XMS/raw, any segment register which contains the
  722.   selector specified in register BX will be reloaded. DPMI 0.9 may do this,
  723.   but it is not guaranteed.
  724.  
  725. ) We hope you have enough sense not to try to modify your current CS or SS
  726.   descriptor or the descriptor of the buffer.
  727.  
  728. 2.10 - Function 0100h - Allocate DOS Memory Block:
  729. --------------------------------------------------
  730.  
  731.   Allocates low memory through DOS function 48h and allocates it a descriptor.
  732.  
  733. In:
  734.   AX     = 0100h
  735.   BX     = paragraphs to allocate
  736.  
  737. Out:
  738.   if successful:
  739.     carry flag clear
  740.     AX       = real mode segment address
  741.     DX       = protected mode selector for memory block
  742.  
  743.   if failed:
  744.     carry flag set
  745.     AX       = DOS error code
  746.     BX       = size of largest available block
  747.  
  748. 2.11 - Function 0101h - Free DOS Memory Block:
  749. ----------------------------------------------
  750.  
  751.   Frees a low memory block previously allocated by function 0100h.
  752.  
  753. In:
  754.   AX     = 0101h
  755.   DX     = protected mode selector for memory block
  756.  
  757. Out:
  758.   if successful:
  759.     carry flag clear
  760.  
  761.   if failed:
  762.     carry flag set
  763.     AX       = DOS error code
  764.  
  765. 2.12 - Function 0102h - Resize DOS Memory Block:
  766. ------------------------------------------------
  767.  
  768.   Resizes a low memory block previously allocated by function 0100h
  769.  
  770. In:
  771.   AX     = 0102h
  772.   BX     = new block size in paragraphs
  773.   DX     = protected mode selector for memory block
  774.  
  775. Out:
  776.   if successful:
  777.     carry flag clear
  778.  
  779.   if failed:
  780.     carry flag set
  781.     AX       = DOS error code
  782.     BX       = size of largest available block
  783.  
  784. 2.13 - Function 0200h - Get Real Mode Interrupt Vector:
  785. -------------------------------------------------------
  786.  
  787.   Returns the real mode segment:offset for the specified interrupt vector.
  788.  
  789. In:
  790.   AX     = 0200h
  791.   BL     = interrupt number
  792.  
  793. Out:
  794.   always successful:
  795.     carry flag clear
  796.     CX:DX  = segment:offset of real mode interrupt handler
  797.  
  798. Notes:
  799. ) The value returned in CX is a real mode segment address, not a protected
  800.   mode selector.
  801.  
  802. 2.14 - Function 0201h - Set Real Mode Interrupt Vector:
  803. -------------------------------------------------------
  804.  
  805.   Sets the real mode segment:offset for the specified interrupt vector.
  806.  
  807. In:
  808.   AX     = 0201h
  809.   BL     = interrupt number
  810.   CX:DX  = segment:offset of real mode interrupt handler
  811.  
  812. Out:
  813.   always successful:
  814.     carry flag clear
  815.  
  816. Notes:
  817. ) The value passed in CX must be a real mode segment address, not a protected
  818.   mode selector. Consequently, the interrupt handler must either reside in
  819.   DOS memory (below the 1M boundary) or the client must allocate a real mode
  820.   callback address.
  821.  
  822. 2.15 - Function 0204h - Get Protected Mode Interrupt Vector:
  823. ------------------------------------------------------------
  824.  
  825.   Returns the address of the current protected mode interrupt handler for the
  826. specified interrupt.
  827.  
  828. In:
  829.   AX     = 0204h
  830.   BL     = interrupt number
  831.  
  832. Out:
  833.   always successful:
  834.     carry flag clear
  835.     CX:EDX = selector:offset of protected mode interrupt handler
  836.  
  837. Notes:
  838. ) The value returned in CX is a valid protected mode selector, not a real mode
  839.   segment address.
  840.  
  841. 2.16 - Function 0205h - Set Protected Mode Interrupt Vector:
  842. ------------------------------------------------------------
  843.  
  844.   Sets the address of the protected mode interrupt handler for the specified
  845. interrupt.
  846.  
  847. In:
  848.   AX     = 0205h
  849.   BL     = interrupt number
  850.   CX:EDX = selector offset of protected mode interrupt handler
  851.  
  852. Out:
  853.   if successful:
  854.     carry flag clear
  855.  
  856.   if failed:
  857.     carry flag set
  858.  
  859. Notes:
  860. ) The value passed in CX must be a valid protected mode selector, not a real
  861.   mode segment address.
  862.  
  863. 2.17 - Function 0300h - Simulate Real Mode Interrupt:
  864. -----------------------------------------------------
  865.  
  866.   Simulates an interrupt in real mode. The function transfers control to the
  867. address specified by the real mode interrupt vector. The real mode handler
  868. must return by executing an IRET.
  869.  
  870. In:
  871.   AX     = 0300h
  872.   BL     = interrupt number
  873.   BH     = must be 0
  874.   CX     = number of words to copy from the protected mode stack to the real
  875.            mode stack
  876.   ES:EDI = selector:offset of real mode register data structure in the
  877.            following format:
  878.  
  879.            Offset  Length  Contents
  880.            00h     4       EDI
  881.            04h     4       ESI
  882.            08h     4       EBP
  883.            0ch     4       reserved, ignored
  884.            10h     4       EBX
  885.            14h     4       EDX
  886.            18h     4       ECX
  887.            1ch     4       EAX
  888.            20h     2       CPU status flags
  889.            22h     2       ES
  890.            24h     2       DS
  891.            26h     2       FS
  892.            28h     2       GS
  893.            2ah     2       IP (reserved, ignored)
  894.            2ch     2       CS (reserved, ignored)
  895.            2eh     2       SP
  896.            30h     2       SS
  897.  
  898. Out:
  899.   if successful:
  900.     carry flag clear
  901.     ES:EDI = selector offset of modified real mode register data structure
  902.  
  903.   if failed:
  904.     carry flag set
  905.  
  906. Notes:
  907. ) The CS:IP in the real mode register data structure is ignored by this
  908.   function. The appropriate interrupt handler will be called based on the
  909.   value passed in BL.
  910.  
  911. ) If the SS:SP fields in the real mode register data structure are zero, a
  912.   real mode stack will be provided by the host. Otherwise the real mode SS:SP
  913.   will be set to the specified values before the interrupt handler is called.
  914.  
  915. ) The flags specified in the real mode register data structure will be put on
  916.   the real mode interrupt handler's IRET frame. The interrupt handler will be
  917.   called with the interrupt and trace flags clear.
  918.  
  919. ) Values placed in the segment register positions of the data structure must
  920.   be valid for real mode. That is, the values must be paragraph addresses, not
  921.   protected mode selectors.
  922.  
  923. ) The target real mode handler must return with the stack in the same state
  924.   as when it was called. This means that the real mode code may switch stacks
  925.   while it is running, but must return on the same stack that it was called
  926.   on and must return with an IRET.
  927.  
  928. ) When this function returns, the real mode register data structure will
  929.   contain the values that were returned by the real mode interrupt handler.
  930.   The CS:IP and SS:SP values will be unmodified in the data structure.
  931.  
  932. ) It is the caller's responsibility to remove any parameters that were pushed
  933.   on the protected mode stack.
  934.  
  935. 2.18 - Function 0301h - Call Real Mode Procedure With Far Return Frame:
  936. -----------------------------------------------------------------------
  937.  
  938.   Simulates a FAR CALL to a real mode procedure. The called procedure must
  939. return by executing a RETF instruction.
  940.  
  941. In:
  942.   AX     = 0301h
  943.   BH     = must be 0
  944.   CX     = number of words to copy from the protected mode stack to the real
  945.            mode stack
  946.   ES:EDI = selector:offset of real mode register data structure in the
  947.            following format:
  948.  
  949.            Offset  Length  Contents
  950.            00h     4       EDI
  951.            04h     4       ESI
  952.            08h     4       EBP
  953.            0ch     4       reserved, ignored
  954.            10h     4       EBX
  955.            14h     4       EDX
  956.            18h     4       ECX
  957.            1ch     4       EAX
  958.            20h     2       CPU status flags
  959.            22h     2       ES
  960.            24h     2       DS
  961.            26h     2       FS
  962.            28h     2       GS
  963.            2ah     2       IP
  964.            2ch     2       CS
  965.            2eh     2       SP
  966.            30h     2       SS
  967.  
  968. Out:
  969.   if successful:
  970.     carry flag clear
  971.     ES:EDI = selector offset of modified real mode register data structure
  972.  
  973.   if failed:
  974.     carry flag set
  975.  
  976. Notes:
  977. ) The CS:IP in the real mode register data structure specifies the address of
  978.   the real mode procedure to call.
  979.  
  980. ) If the SS:SP fields in the real mode register data structure are zero, a
  981.   real mode stack will be provided by the host. Otherwise the real mode SS:SP
  982.   will be set to the specified values before the procedure is called.
  983.  
  984. ) Values placed in the segment register positions of the data structure must
  985.   be valid for real mode. That is, the values must be paragraph addresses, not
  986.   protected mode selectors.
  987.  
  988. ) The target real mode procedure must return with the stack in the same state
  989.   as when it was called. This means that the real mode code may switch stacks
  990.   while it is running, but must return on the same stack that it was called
  991.   on and must return with a RETF and should not clear the stack of any
  992.   parameters that were passed to it on the stack.
  993.  
  994. ) When this function returns, the real mode register data structure will
  995.   contain the values that were returned by the real mode procedure. The CS:IP
  996.   and SS:SP values will be unmodified in the data structure.
  997.  
  998. ) It is the caller's responsibility to remove any parameters that were pushed
  999.   on the protected mode stack.
  1000.  
  1001. 2.19 - Function 0302h - Call Real Mode Procedure With IRET Frame:
  1002. -----------------------------------------------------------------
  1003.  
  1004.   Simulates a FAR CALL with flags pushed on the stack to a real mode routine.
  1005. The real mode procedure must return by executing an IRET instruction or a
  1006. RETF 2.
  1007.  
  1008. In:
  1009.   AX     = 0302h
  1010.   BH     = must be 0
  1011.   CX     = number of words to copy from the protected mode stack to the real
  1012.            mode stack
  1013.   ES:EDI = selector:offset of real mode register data structure in the
  1014.            following format:
  1015.  
  1016.            Offset  Length  Contents
  1017.            00h     4       EDI
  1018.            04h     4       ESI
  1019.            08h     4       EBP
  1020.            0ch     4       reserved, ignored
  1021.            10h     4       EBX
  1022.            14h     4       EDX
  1023.            18h     4       ECX
  1024.            1ch     4       EAX
  1025.            20h     2       CPU status flags
  1026.            22h     2       ES
  1027.            24h     2       DS
  1028.            26h     2       FS
  1029.            28h     2       GS
  1030.            2ah     2       IP
  1031.            2ch     2       CS
  1032.            2eh     2       SP
  1033.            30h     2       SS
  1034.  
  1035. Out:
  1036.   if successful:
  1037.     carry flag clear
  1038.     ES:EDI = selector offset of modified real mode register data structure
  1039.  
  1040.   if failed:
  1041.     carry flag set
  1042.  
  1043. Notes:
  1044. ) The CS:IP in the real mode register data structure specifies the address of
  1045.   the real mode procedure to call.
  1046.  
  1047. ) If the SS:SP fields in the real mode register data structure are zero, a
  1048.   real mode stack will be provided by the host. Otherwise the real mode SS:SP
  1049.   will be set to the specified values before the procedure is called.
  1050.  
  1051. ) The flags specified in the real mode register data structure will be put on
  1052.   the real mode procedure's IRET frame. The procedure will be called with the
  1053.   interrupt and trace flags clear.
  1054.  
  1055. ) Values placed in the segment register positions of the data structure must
  1056.   be valid for real mode. That is, the values must be paragraph addresses, not
  1057.   protected mode selectors.
  1058.  
  1059. ) The target real mode procedure must return with the stack in the same state
  1060.   as when it was called. This means that the real mode code may switch stacks
  1061.   while it is running, but must return on the same stack that it was called
  1062.   on and must return with an IRET or discard the flags from the stack with a
  1063.   RETF 2 and should not clear the stack of any parameters that were passed to
  1064.   it on the stack.
  1065.  
  1066. ) When this function returns, the real mode register data structure will
  1067.   contain the values that were returned by the real mode procedure. The CS:IP
  1068.   and SS:SP values will be unmodified in the data structure.
  1069.  
  1070. ) It is the caller's responsibility to remove any parameters that were pushed
  1071.   on the protected mode stack.
  1072.  
  1073. 2.20 - Function 0303h - Allocate Real Mode Callback Address:
  1074. ------------------------------------------------------------
  1075.  
  1076.   Returns a unique real mode segment:offset, known as a "real mode callback",
  1077. that will transfer control from real mode to a protected mode procedure.
  1078. Callback addresses obtained with this function can be passed by a protected
  1079. mode program to a real mode application, interrupt handler, device driver,
  1080. TSR, etc... so that the real mode program can call procedures within the
  1081. protected mode program.
  1082.  
  1083. In:
  1084.   AX     = 0303h
  1085.   DS:ESI = selector:offset of protected mode procedure to call
  1086.   ES:EDI = selector:offset of 32h byte buffer for real mode register data
  1087.            structure to be used when calling the callback routine.
  1088.  
  1089. Out:
  1090.   if successful:
  1091.     carry flag clear
  1092.     CX:DX  = segment:offset of real mode callback
  1093.  
  1094.   if failed:
  1095.     carry flag set
  1096.  
  1097. Notes:
  1098. ) A descriptor may be allocated for each callback to hold the real mode SS
  1099.   descriptor. Real mode callbacks are a limited system resource. A client
  1100.   should release a callback that it is no longer using.
  1101.  
  1102. 2.21 - Function 0304h - Free Real Mode Callback Address:
  1103. --------------------------------------------------------
  1104.  
  1105.   Releases a real mode callback address that was previously allocated with the
  1106. Allocate Real Mode Callback Address function (0303h).
  1107.  
  1108. In:
  1109.   AX     = 0304h
  1110.   CX:DX  = segment:offset of real mode callback to be freed
  1111.  
  1112. Out:
  1113.   if successful:
  1114.     carry flag clear
  1115.  
  1116.   if failed:
  1117.     carry flag set
  1118.  
  1119. Notes:
  1120. ) Real mode callbacks are a limited system resource. A client should release
  1121.   any callback that it is no longer using.
  1122.  
  1123. 2.22 - Function 0305h - Get State Save/Restore Addresses:
  1124. ---------------------------------------------------------
  1125.  
  1126.   Returns the address of two procedures used to save and restore the state of
  1127. the current task's registers in the mode (protected or real) which is not
  1128. currently executing.
  1129.  
  1130. In:
  1131.   AX     = 0305h
  1132.  
  1133. Out:
  1134.   always successful:
  1135.     carry flag clear
  1136.     AX       = size of buffer in bytes required to save state
  1137.     BX:CX  = segment:offset of real mode routine used to save/restore state
  1138.     SI:EDI = selector:offset of protected mode routine used to save/restore
  1139.          state
  1140.  
  1141. Notes:
  1142. ) The real mode segment:offset returned by this function should be called
  1143.   only in real mode to save/restore the state of the protected mode registers.
  1144.   The protected mode selector:offset returned by this function should be
  1145.   called only in protected mode to save/restore the state of the real mode
  1146.   registers.
  1147.  
  1148. ) Both of the state save/restore procedures are entered by a FAR CALL with the
  1149.   following parameters:
  1150.  
  1151.   AL       = 0 to save state
  1152.            = 1 to restore state
  1153.   ES:(E)DI = (selector or segment):offset of state buffer
  1154.  
  1155.   The state buffer must be at least as large as the value returned in AX by
  1156.   INT 31h function 0305h. The state save/restore procedures do not modify any
  1157.   registers. DI must be used for the buffer offset in real mode, EDI must be
  1158.   used in protected mode.
  1159.  
  1160. ) Some DPMI hosts and VCPI/XMS/raw will not require the state to be saved,
  1161.   indicating this by returning a buffer size of zero in AX. In such cases,
  1162.   that addresses returned by this function can still be called, although they
  1163.   will simply return without performing any useful function.
  1164.  
  1165. ) Clients do not need to call the state save/restore procedures before using
  1166.   INT 31h function 0300h, 0301h, or 0302h. The state save/restore procedures
  1167.   are provided for clients that use the raw mode switch services only.
  1168.  
  1169. 2.23 - Function 0306h - Get Raw Mode Switch Addresses:
  1170. ------------------------------------------------------
  1171.  
  1172.   Returns addresses that can be called for low level mode switching.
  1173.  
  1174. In:
  1175.   AX     = 0306h
  1176.  
  1177. Out:
  1178.   always successful:
  1179.     carry flag clear
  1180.     BX:CX  = segment:offset of real to protected mode switch procedure
  1181.     SI:EDI = selector:offset of protected to real mode switch procedure
  1182.  
  1183. Notes:
  1184. ) The real mode segment:offset returned by this function should be called
  1185.   only in real mode to switch to protected mode. The protected mode
  1186.   selector:offset returned by this function should be called only in protected
  1187.   mode to switch to real mode.
  1188.  
  1189. ) The mode switch procedures are entered by a FAR JMP to the appropriate
  1190.   address with the following parameters:
  1191.  
  1192.   AX    = new DS
  1193.   CX    = new ES
  1194.   DX    = new SS
  1195.   (E)BX = new (E)SP
  1196.   SI    = new CS
  1197.   (E)DI = new (E)IP
  1198.  
  1199.   The processor is placed into the desired mode, and the DS, ES, SS, (E)SP,
  1200.   CS, and (E)IP registers are updated with the specific values. In other
  1201.   words, execution of the client continues in the requested mode at the
  1202.   address provided in registers SI:(E)DI. The values specified to be placed
  1203.   into the segment registers must be appropriate for the destination mode.
  1204.   That is, segment addresses for real mode, and selectors for protected mode.
  1205.  
  1206.   The values in EAX, EBX, ECX, EDX, ESI, and EDI after the mode switch are
  1207.   undefined. EBP will be preserved across the mode switch call so it can be
  1208.   used as a pointer. FS and GS will contain zero after the mode switch.
  1209.  
  1210.   If interrupts are disabled when the mode switch procedure is invoked, they
  1211.   will not be re-enabled by the host (even temporarily).
  1212.  
  1213. ) It is up to the client to save and restore the state of the task when using
  1214.   this function to switch modes. This requires the state save/restore
  1215.   procedures whose addresses can be obtained with INT 31h function 0305h.
  1216.  
  1217. 2.24 - Function 0400h - Get Version:
  1218. ------------------------------------
  1219.  
  1220.   Returns the version of the DPMI Specification implemented by the DPMI host.
  1221. The client can use this information to determine what functions are available.
  1222.  
  1223. In:
  1224.   AX     = 0400h
  1225.  
  1226. Out:
  1227.   always successful:
  1228.     carry flag clear
  1229.     AH     = DPMI major version as a binary number (VCPI/XMS/raw returns 00h)
  1230.     AL     = DPMI minor version as a binary number (VCPI/XMS/raw returns 5ah)
  1231.     BX       = flags:
  1232.          Bits    Significance
  1233.              0       0 = host is 16bit (PMODE/W never runs under one of these)
  1234.              1 = host is 32bit
  1235.          1         0 = CPU returned to V86 mode for reflected interrupts
  1236.              1 = CPU returned to real mode for reflected interrupts
  1237.          2         0 = virtual memory not supported
  1238.              1 = virtual memory supported
  1239.          3-15    reserved
  1240.     CL       = processor type:
  1241.          03h = 80386
  1242.          04h = 80486
  1243.          05h = 80586
  1244.          06h-ffh = reserved
  1245.     DH       = current value of master PIC base interrupt (low 8 IRQs)
  1246.     DL       = current value of slave PIC base interrupt (high 8 IRQs)
  1247.  
  1248. Notes:
  1249. ) The major and minor version numbers are binary, not BCD. So a DPMI 0.9
  1250.   implementation would return AH as 0 and AL as 5ah (90).
  1251.  
  1252. 2.25 - Function 0500h - Get Free Memory Information:
  1253. ----------------------------------------------------
  1254.  
  1255.   Returns information about the amount of available memory. Since DPMI clients
  1256. could be running in a multitasking environment, the information returned by
  1257. this function should be considered advisory.
  1258.  
  1259. In:
  1260.   AX     = 0500h
  1261.   ES:EDI = selector:offset of 48 byte buffer
  1262.  
  1263. Out:
  1264.   if successful:
  1265.     carry flag clear
  1266.     buffer is filled with the following information:
  1267.  
  1268.       Offset  Length  Contents
  1269.       00h     4       Largest available free block in bytes
  1270.       04h     2ch     Other fields only supplied by DPMI
  1271.  
  1272.   if failed:
  1273.     carry flag set
  1274.  
  1275. Notes:
  1276. ) Only the first field of the structure is guaranteed to contain a valid
  1277.   value. Any fields that are not supported by the host will be set to -1
  1278.   (0ffffffffh) to indicate that the information is not available.
  1279.  
  1280. 2.26 - Function 0501h - Allocate Memory Block:
  1281. ----------------------------------------------
  1282.  
  1283.   Allocates a block of extended memory.
  1284.  
  1285. In:
  1286.   AX     = 0501h
  1287.   BX:CX  = size of block in bytes (must be non-zero)
  1288.  
  1289. Out:
  1290.   if successful:
  1291.     carry flag clear
  1292.     BX:CX  = linear address of allocated memory block
  1293.     SI:DI  = memory block handle (used to resize and free block)
  1294.  
  1295.   if failed:
  1296.     carry flag set
  1297.  
  1298. Notes:
  1299. ) The allocated block is guaranteed to have at least dword alignment.
  1300.  
  1301. ) This function does not allocate any descriptors for the memory block. It is
  1302.   the responsibility of the client to allocate and initialize any descriptors
  1303.   needed to access the memory with additional function calls.
  1304.  
  1305. 2.27 - Function 0502h - Free Memory Block:
  1306. ------------------------------------------
  1307.  
  1308.   Frees a memory block previously allocated with the Allocate Memory Block
  1309. function (0501h).
  1310.  
  1311. In:
  1312.   AX     = 0502h
  1313.   SI:DI  = memory block handle
  1314.  
  1315. Out:
  1316.   if successful:
  1317.     carry flag clear
  1318.  
  1319.   if failed:
  1320.     carry flag set
  1321.  
  1322. Notes:
  1323. ) No descriptors are freed by this call. It is the client's responsibility to
  1324.   free any descriptors that it previously allocated to map the memory block.
  1325.   Descriptors should be freed before memory blocks.
  1326.  
  1327. 2.28 - Function 0503h - Resize Memory Block:
  1328. --------------------------------------------
  1329.  
  1330.   Changes the size of a memory block previously allocated with the Allocate
  1331. Memory Block function (0501h).
  1332.  
  1333. In:
  1334.   AX     = 0503h
  1335.   BX:CX  = new size of block in bytes (must be non-zero)
  1336.   SI:DI  = memory block handle
  1337.  
  1338. Out:
  1339.   if successful:
  1340.     carry flag clear
  1341.     BX:CX  = new linear address of memory block
  1342.     SI:DI  = new memory block handle
  1343.  
  1344.   if failed:
  1345.     carry flag set
  1346.  
  1347. Notes:
  1348. ) After this function returns successfully, the previous handle for the memory
  1349.   block is invalid and should not be used anymore.
  1350.  
  1351. ) It is the client's responsibility to update any descriptors that map the
  1352.   memory block with the new linear address after resizing the block.
  1353.  
  1354. 2.29 - Function 0800h - Physical Address Mapping:
  1355. -------------------------------------------------
  1356.  
  1357.   Converts a physical address into a linear address. This functions allows the
  1358. client to access devices mapped at a specific physical memory address.
  1359. Examples of this are the frame buffers of certain video cards in extended
  1360. memory.
  1361.  
  1362. In:
  1363.   AX     = 0800h
  1364.   BX:CX  = physical address of memory
  1365.   SI:DI  = size of region to map in bytes
  1366.  
  1367. Out:
  1368.   if successful:
  1369.     carry flag clear
  1370.     BX:CX  = linear address that can be used to access the physical memory
  1371.  
  1372.   if failed:
  1373.     carry flag set
  1374.  
  1375. Notes:
  1376. ) It is the caller's responsibility to allocate and initialize a descriptor
  1377.   for access to the memory.
  1378.  
  1379. ) Clients should not use this function to access memory below the 1 MB
  1380.   boundary.
  1381.  
  1382. 2.30 - Function 0801h - Free Physical Address Mapping:
  1383. ------------------------------------------------------
  1384.  
  1385.   Releases a mapping of physical to linear addresses that was previously
  1386. obtained with function 0800h.
  1387.  
  1388. In:
  1389.   AX     = 0801h
  1390.   BX:CX  = linear address returned by physical address mapping call
  1391.  
  1392. Out:
  1393.   if successful:
  1394.     carry flag clear
  1395.  
  1396.   if failed:
  1397.     carry flag set
  1398.  
  1399. Notes:
  1400. ) The client should call this function when it is finished using a device
  1401.   previously mapped to linear addresses with function 0801h.
  1402.  
  1403. 2.31 - Function 0900h - Get and Disable Virtual Interrupt State:
  1404. ----------------------------------------------------------------
  1405.  
  1406.   Disables the virtual interrupt flag and returns the previous state of it.
  1407.  
  1408. In:
  1409.   AX     = 0900h
  1410.  
  1411. Out:
  1412.   always successful:
  1413.     carry flag clear
  1414.     AL       = 0 if virtual interrupts were previously disabled
  1415.     AL       = 1 if virtual interrupts were previously enabled
  1416.  
  1417. Notes:
  1418. ) AH is not changed by this function. Therefore the previous state can be
  1419.   restored by simply executing another INT 31h.
  1420.  
  1421. ) A client that does not need to know the prior interrupt state can execute
  1422.   the CLI instruction rather than calling this function. The instruction may
  1423.   be trapped by a DPMI host and should be assumed to be very slow.
  1424.  
  1425. 2.32 - Function 0901h - Get and Enable Virtual Interrupt State:
  1426. ---------------------------------------------------------------
  1427.  
  1428.   Enables the virtual interrupt flag and returns the previous state of it.
  1429.  
  1430. In:
  1431.   AX     = 0901h
  1432.  
  1433. Out:
  1434.   always successful:
  1435.     carry flag clear
  1436.     AL       = 0 if virtual interrupts were previously disabled
  1437.     AL       = 1 if virtual interrupts were previously enabled
  1438.  
  1439. Notes:
  1440. ) AH is not changed by this function. Therefore the previous state can be
  1441.   retstored by simply executing another INT 31h.
  1442.  
  1443. ) A client that does not need to know the prior interrupt state can execute
  1444.   the STI instruction rather than calling this function. The instruction may
  1445.   be trapped by a DPMI host and should be assumed to be very slow.
  1446.  
  1447. 2.33 - Function 0902h - Get Virtual Interrupt State:
  1448. ----------------------------------------------------
  1449.  
  1450.   Returns the current state of the virtual interrupt flag.
  1451.  
  1452. In:
  1453.   AX     = 0902h
  1454.  
  1455. Out:
  1456.   always successful:
  1457.     carry flag clear
  1458.     AL       = 0 if virtual interrupts are disabled
  1459.     AL       = 1 if virtual interrupts are enabled
  1460.  
  1461. Notes:
  1462. ) This function should be used in preference to the PUSHF instruction to
  1463.   examine the interrupt flag, because the PUSHF instruction returns the
  1464.   physical interrupt flag rather than the virtualized interrupt flag. On some
  1465.   DPMI hosts, the physical interrupt flag will always be enabled, even when
  1466.   the hardware interrupts are not being passed through to the client.
  1467.  
  1468. 2.34 - Function EEFFh - Get DOS Extender Information:
  1469. -----------------------------------------------------
  1470.  
  1471.   Returns information about the DOS extender.
  1472.  
  1473. In:
  1474.   AX     = EEFFh
  1475.  
  1476. Out:
  1477.   if successful:
  1478.     carry flag clear
  1479.     EAX    = 'PMDW' (504D4457h)
  1480.     ES:EBX -> ASCIIZ copyright string
  1481.     CH     = protected mode system type (0=raw, 1=XMS, 2=VCPI, 3=DPMI)
  1482.     CL     = processor type (3=386, 4=486, 5=586)
  1483.     DH     = extender MAJOR version (binary)
  1484.     DL     = extender MINOR version (binary)
  1485.  
  1486.   if failed:
  1487.     carry flag set
  1488.  
  1489. Notes:
  1490. ) In PMODE/W's implementation of this function, the value returned in ES is
  1491.   equivalent to the 4G data selector returned in DS at startup.
  1492.  
  1493. ) This function is always successful under PMODE/W.
  1494.  
  1495. ------------------------------------------------------------------------------
  1496. -------------- 3 - Supported DOS extended INT 21h functions ------------------
  1497. ------------------------------------------------------------------------------
  1498.  
  1499.   For the most part, PMODE/W extends only the most widely used DOS functions.
  1500. The term "extend" means to extend real mode 16:16 pointers which have a limit
  1501. of 1MB into the full protected mode range of 16:32 pointers with a range of
  1502. 4GB. Since DOS can only address memory under 1MB, we must buffer any data that
  1503. is to be passed to or from DOS in low memory. Only DOS functions which use
  1504. 16:16 pointers or segment registers need to be extended. This means that DOS
  1505. functions that are not listed here can still be used provided they don't make
  1506. use of those kinds of parameters. Examples of such functions are INT 21h
  1507. AH=30h or INT 21h AH=2, etc. The following is a detailed list of all functions
  1508. extended by PMODE/W. All segment registers used as parameters must be valid
  1509. protected mode selectors. Any functions that are not listed here will be
  1510. passed on to the real mode INT 21h handler without any buffering or
  1511. modification. This and the other sections on interrupts are provided as
  1512. reference as to how PMODE/W deals with these interrupts. It is assumed the
  1513. reader is familiar with the normal real mode operation of these functions.
  1514.  
  1515. 3.0 - Function 09h - Write String to Standard Output:
  1516. -----------------------------------------------------
  1517.  
  1518. In:
  1519.   AH     = 09h
  1520.   DS:EDX -> '$' terminated string to write
  1521.  
  1522. Out:
  1523.   always successful
  1524.  
  1525. 3.1 - Function 1Ah - Set Disk Transfer Area:
  1526. --------------------------------------------
  1527.  
  1528. In:
  1529.   AH     = 1Ah
  1530.   DS:EDX -> buffer for DTA
  1531.  
  1532. Out:
  1533.   always successful
  1534.  
  1535. Notes:
  1536. ) PMODE/W keeps an internal DTA buffer in low memory that is used to buffer
  1537.   any functions which use the DTA. After calling the real mode DOS function,
  1538.   the data will be transfered into the buffer specified by DS:EDX.
  1539.  
  1540. 3.2 - Function 1Bh - Get Allocation Information for Default Drive:
  1541. ------------------------------------------------------------------
  1542.  
  1543. In:
  1544.   AH     = 1Bh
  1545.  
  1546. Out:
  1547.   always successful:
  1548.     AL     = sectors per cluster
  1549.     ECX    = bytes per sector
  1550.     EDX    = total number of clusters
  1551.     DS:EBX -> media ID byte
  1552.  
  1553. Notes:
  1554. ) This functions simply converts the real mode segment:offset returned by DOS
  1555.   to a protected mode selector:offset.
  1556.  
  1557. 3.3 - Function 1Ch - Get Allocation Information for Specific Drive:
  1558. -------------------------------------------------------------------
  1559.  
  1560. In:
  1561.   AH     = 1Ch
  1562.   DL     = drive number
  1563.  
  1564. Out:
  1565.   if successful:
  1566.     AL     = sectors per cluster
  1567.     ECX    = bytes per sector
  1568.     EDX    = total number of clusters
  1569.     DS:EBX -> media ID byte
  1570.  
  1571.   if failed:
  1572.     AL     = FFh (invalid drive)
  1573.  
  1574. Notes:
  1575. ) This functions simply converts the real mode segment:offset returned by DOS
  1576.   to a protected mode selector:offset.
  1577.  
  1578. 3.4 - Function 1Fh - Get Drive Parameter Block for Default Drive:
  1579. -----------------------------------------------------------------
  1580.  
  1581. In:
  1582.   AH     = 1Fh
  1583.  
  1584. Out:
  1585.   if successful:
  1586.     AL     = 0
  1587.     DS:EBX -> drive parameter block
  1588.  
  1589.   if failed:
  1590.     AL     = FFh (invalid drive)
  1591.  
  1592. Notes:
  1593. ) This functions simply converts the real mode segment:offset returned by DOS
  1594.   to a protected mode selector:offset.
  1595.  
  1596. 3.5 - Function 25h - Set Interrupt Vector:
  1597. ------------------------------------------
  1598.  
  1599. In:
  1600.   AH     = 25h
  1601.   AL     = interrupt number
  1602.   DS:EDX -> interrupt routine
  1603.  
  1604. Out:
  1605.   if successful:
  1606.     carry flag clear
  1607.  
  1608.   if failed:
  1609.     carry flag set
  1610.  
  1611. Notes:
  1612. ) This function is equivalent to INT 31h function 0205h.
  1613.  
  1614. 3.6 - Function 2Fh - Get Disk Transfer Area:
  1615. --------------------------------------------
  1616.  
  1617. In:
  1618.   AH     = 2Fh
  1619.  
  1620. Out:
  1621.   always successful:
  1622.     ES:EBX -> DTA
  1623.  
  1624. Notes:
  1625. ) This function will return the value that was previously set by function 1Ah
  1626.   or the default buffer if function 1Ah was not called.
  1627.  
  1628. 3.7 - Function 32h - Get Drive Parameter Block for Specific Drive:
  1629. ------------------------------------------------------------------
  1630.  
  1631. In:
  1632.   AH     = 32h
  1633.   DL     = drive number
  1634.  
  1635. Out:
  1636.   if successful:
  1637.     AL     = 0
  1638.     DS:EBX -> drive parameter block
  1639.  
  1640.   if failed:
  1641.     AL     = FFh (invalid drive)
  1642.  
  1643. Notes:
  1644. ) This functions simply converts the real mode segment:offset returned by DOS
  1645.   to a protected mode selector:offset.
  1646.  
  1647. 3.8 - Function 34h - Get Address of InDOS Flag:
  1648. -----------------------------------------------
  1649.  
  1650. In:
  1651.   AH = 34h
  1652.  
  1653. Out:
  1654.   always successful:
  1655.     ES:EBX -> InDOS flag
  1656.  
  1657. Notes:
  1658. ) This functions simply converts the real mode segment:offset returned by DOS
  1659.   to a protected mode selector:offset.
  1660.  
  1661. 3.9 - Function 35h - Get Interrupt Vector:
  1662. ------------------------------------------
  1663.  
  1664. In:
  1665.   AH     = 35h
  1666.   AL     = interrupt number
  1667.  
  1668. Out:
  1669.   always successful:
  1670.     ES:EBX -> interrupt routine
  1671.  
  1672. Notes:
  1673. ) This function is equivalent to INT 31h function 0204h.
  1674.  
  1675. 3.10 - Function 39h - Create Subdirectory:
  1676. ------------------------------------------
  1677.  
  1678. In:
  1679.   AH     = 39h
  1680.   DS:EDX -> ASCIIZ path name
  1681.  
  1682. Out:
  1683.   if successful:
  1684.     carry flag clear
  1685.  
  1686.   if failed:
  1687.     carry flag set
  1688.     EAX = error code
  1689.  
  1690. 3.11 - Function 3Ah - Remove Subdirectory:
  1691. ------------------------------------------
  1692.  
  1693. In:
  1694.   AH     = 3Ah
  1695.   DS:EDX -> ASCIIZ path name
  1696.  
  1697. Out:
  1698.   if successful:
  1699.     carry flag clear
  1700.  
  1701.   if failed:
  1702.     carry flag set
  1703.     EAX = error code
  1704.  
  1705. 3.12 - Function 3Bh - Set Directory:
  1706. ------------------------------------
  1707.  
  1708. In:
  1709.   AH     = 3Bh
  1710.   DS:EDX -> ASCIIZ path name
  1711.  
  1712. Out:
  1713.   if successful:
  1714.     carry flag clear
  1715.  
  1716.   if failed:
  1717.     carry flag set
  1718.     EAX = error code
  1719.  
  1720. 3.13 - Function 3Ch - Create File:
  1721. ----------------------------------
  1722.  
  1723. In:
  1724.   AH     = 3Ch
  1725.   CX     = attribute
  1726.   DS:EDX -> ASCIIZ path name
  1727.  
  1728. Out:
  1729.   if successful:
  1730.     carry flag clear
  1731.     EAX = handle
  1732.  
  1733.   if failed:
  1734.     carry flag set
  1735.     EAX = error code
  1736.  
  1737. 3.14 - Function 3Dh - Open File:
  1738. --------------------------------
  1739.  
  1740. In:
  1741.   AH     = 3Dh
  1742.   AL     = open code
  1743.   DS:EDX -> ASCIIZ path name
  1744.  
  1745. Out:
  1746.   if successful:
  1747.     carry flag clear
  1748.     EAX = handle
  1749.  
  1750.   if failed:
  1751.     carry flag set
  1752.     EAX = error code
  1753.  
  1754. 3.15 - Function 3Fh - Read From File:
  1755. -------------------------------------
  1756.  
  1757. In:
  1758.   AH     = 3Fh
  1759.   BX     = file handle
  1760.   ECX     = number of bytes to read
  1761.   DS:EDX -> buffer to read to
  1762.  
  1763. Out:
  1764.   if successful:
  1765.     carry flag clear
  1766.     EAX = number of bytes read
  1767.  
  1768.   if failed:
  1769.     carry flag set
  1770.     EAX = error code
  1771.  
  1772. 3.16 - Function 40h - Write To File:
  1773. ------------------------------------
  1774.  
  1775. In:
  1776.   AH     = 40h
  1777.   BX     = file handle
  1778.   ECX     = number of bytes to write
  1779.   DS:EDX -> buffer to write from
  1780.  
  1781. Out:
  1782.   if successful:
  1783.     carry flag clear
  1784.     EAX = number of bytes written
  1785.  
  1786.   if failed:
  1787.     carry flag set
  1788.     EAX = error code
  1789.  
  1790. 3.17 - Function 41h - Delete File:
  1791. ----------------------------------
  1792.  
  1793. In:
  1794.   AH     = 41h
  1795.   DS:EDX -> ASCIIZ path name
  1796.  
  1797. Out:
  1798.   if successful:
  1799.     carry flag clear
  1800.  
  1801.   if failed:
  1802.     carry flag set
  1803.     EAX = error code
  1804.  
  1805. 3.18 - Function 43h - Get/Set File Attributes:
  1806. ----------------------------------------------
  1807.  
  1808. In:
  1809.   AH     = 43h
  1810.   AL     = function code
  1811.   CX     = desired attributes
  1812.   DS:EDX -> ASCIIZ path name
  1813.  
  1814. Out:
  1815.   if successful:
  1816.     carry flag clear
  1817.     CX = current attributes
  1818.  
  1819.   if failed:
  1820.     carry flag set
  1821.     EAX = error code
  1822.  
  1823. 3.19 - Function 47h - Get Directory Path:
  1824. -----------------------------------------
  1825.  
  1826. In:
  1827.   AH     = 47h
  1828.   DL     = drive number
  1829.   DS:ESI -> buffer for path
  1830.  
  1831. Out:
  1832.   if successful:
  1833.     carry flag clear
  1834.     buffer pointer to by DS:ESI is filled with the path
  1835.  
  1836.   if failed:
  1837.     carry flag set
  1838.     EAX = error code
  1839.  
  1840. 3.20 - Function 48h - Allocate Memory Block:
  1841. --------------------------------------------
  1842.  
  1843. In:
  1844.   AH     = 48h
  1845.   BX     = paragraphs to allocate
  1846.  
  1847. Out:
  1848.   if successful:
  1849.     carry flag clear
  1850.     EAX = selector for memory block
  1851.  
  1852.   if failed:
  1853.     carry flag set
  1854.     EAX = error code
  1855.     EBX = maximum paragraphs available
  1856.  
  1857. Notes:
  1858. ) This function allocates ONLY DOS memory below 1MB.
  1859.  
  1860. ) This function is equivalent to INT 31h function 0100h.
  1861.  
  1862. 3.21 - Function 49h - Free Memory Block:
  1863. ----------------------------------------
  1864.  
  1865. In:
  1866.   AH     = 49h
  1867.   ES     = selector for memory block
  1868.  
  1869. Out:
  1870.   if successful:
  1871.     carry flag clear
  1872.     ES = NULL selector (zeroed to prevent loading an invalid selector)
  1873.  
  1874.   if failed:
  1875.     carry flag set
  1876.     EAX = error code
  1877.  
  1878. Notes:
  1879. ) This function is equivalent to INT 31h function 0101h.
  1880.  
  1881. 3.22 - Function 4Ah - Resize Memory Block:
  1882. ------------------------------------------
  1883.  
  1884. In:
  1885.   AH     = 4Ah
  1886.   BX     = total paragraphs to allocate
  1887.   ES     = selector
  1888.  
  1889. Out:
  1890.   if successful:
  1891.     carry flag clear
  1892.  
  1893.   if failed:
  1894.     carry flag set
  1895.     EAX = error code
  1896.     EBX = maximum paragraphs available for specified memory block
  1897.  
  1898. Notes:
  1899. ) This function is equivalent to INT 31h function 0102h.
  1900.  
  1901. 3.23 - Function 4Bh - Sub-Function 00h - Load and Execute Program:
  1902. ------------------------------------------------------------------
  1903.  
  1904. In:
  1905.   AH     = 4Bh
  1906.   AL     = 00h
  1907.   DS:EDX -> path name
  1908.   ES:EBX -> parameter block
  1909.  
  1910. Out:
  1911.   if successful:
  1912.     carry flag clear
  1913.  
  1914.   if failed:
  1915.     carry flag set
  1916.  
  1917. Notes:
  1918. ) In order to overcome DOS's inability to access data over 1 MB, the
  1919.   environment specified in the parameter block will be copied into an
  1920.   intermediate buffer before being passed on to DOS. The buffer will be
  1921.   allocated through DOS function 48h and freed through 49h when the program
  1922.   is done executing. There must be enough available low memory to hold the
  1923.   environment data or an error will occur. Keep this in mind when passing
  1924.   an environment using spawnle() and related functions.
  1925.  
  1926. 3.24 - Function 4Eh - Search for First Filename Match:
  1927. ------------------------------------------------------
  1928.  
  1929. In:
  1930.   AH     = 4Eh
  1931.   CX     = file attribute
  1932.   DS:EDX -> ASCIIZ path name
  1933.  
  1934. Out:
  1935.   if successful:
  1936.     carry flag clear
  1937.  
  1938.   if failed:
  1939.     carry flag set
  1940.     EAX = error code
  1941.  
  1942. Notes:
  1943. ) PMODE/W keeps an internal DTA buffer in low memory that is used to buffer
  1944.   any functions which use the DTA. After calling the real mode DOS function,
  1945.   the data will be transfered into the buffer specified by function 1Ah or
  1946.   the default buffer if function 1Ah was not called.
  1947.  
  1948. 3.25 - Function 4Fh - Search for Next Filename Match:
  1949. -----------------------------------------------------
  1950.  
  1951. In:
  1952.   AH     = 4Fh
  1953.  
  1954. Out:
  1955.   if successful:
  1956.     carry flag clear
  1957.  
  1958.   if failed:
  1959.     carry flag set
  1960.     EAX = error code
  1961.  
  1962. Notes:
  1963. ) PMODE/W keeps an internal DTA buffer in low memory that is used to buffer
  1964.   any functions which use the DTA. After calling the real mode DOS function,
  1965.   the data will be transfered into the buffer specified by function 1Ah or
  1966.   the default buffer if function 1Ah was not called.
  1967.  
  1968. 3.26 - Function 56h - Rename File:
  1969. ----------------------------------
  1970.  
  1971. In:
  1972.   AH     = 56h
  1973.   DS:EDX -> old filename
  1974.   ES:EDI -> new filename
  1975.  
  1976. Out:
  1977.   if successful:
  1978.     carry flag clear
  1979.  
  1980.   if failed:
  1981.     carry flag set
  1982.     EAX = error code
  1983.  
  1984. ------------------------------------------------------------------------------
  1985. --------------- 4 - Supported mouse extended INT 33h functions ---------------
  1986. ------------------------------------------------------------------------------
  1987.  
  1988.   The mouse functions are technically not part of Watcom C/C++ support because
  1989. they are not used by any of the libraries. But we extend the most popular
  1990. functions because they are so widely used. The functions that need to be
  1991. extended are those that require addresses to be passed in segment registers.
  1992. All other mouse functions not listed here will work if they do not take
  1993. segment registers as parameters. This means that in addition to the functions
  1994. listed here, functions like 0000h, 0001h, 0002h, etc... will work. But
  1995. functions like 0012h and 0018h will not work directly from protected mode
  1996. because they pass or return segment registers as parameters or require low
  1997. memory buffering. You may still use those functions, but you must call them
  1998. through DPMI and make sure that any code or data they use resides in low
  1999. memory and the code is real mode code (like DPMI callback if you wish to pass
  2000. control on to protected mode code from there).
  2001.  
  2002. 4.0 - Function 0009h - Define Graphics Cursor:
  2003. ----------------------------------------------
  2004.  
  2005. In:
  2006.   AX     = 0009h
  2007.   BX     = column of cursor hot spot in bitmap
  2008.   CX     = row of cursor hot spot in bitmap
  2009.   ES:EDX -> mask bitmap
  2010.  
  2011. Out:
  2012.   always successful
  2013.  
  2014. 4.1 - Function 000Ch - Define Interrupt Subroutine Parameters:
  2015. --------------------------------------------------------------
  2016.  
  2017. In:
  2018.   AX     = 000Ch
  2019.   CX     = call mask
  2020.   ES:EDX -> FAR routine
  2021.  
  2022. Out:
  2023.   always successful
  2024.  
  2025. Notes:
  2026. ) This function will use a DPMI real mode callback to pass control from real
  2027.   mode to your protected mode interrupt subroutine.
  2028.  
  2029. ) Calling this function with a FAR routine of 0000:00000000 is analogous to
  2030.   calling the real mode mouse driver with an address of 0000:0000 which will
  2031.   undefine the interrupt subroutine.
  2032.  
  2033. 4.2 - Function 0016h - Save Driver State:
  2034. -----------------------------------------
  2035.  
  2036. In:
  2037.   AX     = 0016h
  2038.   BX     = size of buffer
  2039.   ES:EDX -> buffer for driver state
  2040.  
  2041. Out:
  2042.   always successful
  2043.  
  2044. 4.3 - Function 0017h - Restore Driver State:
  2045. --------------------------------------------
  2046.  
  2047. In:
  2048.   AX     = 0017h
  2049.   BX     = size of buffer
  2050.   ES:EDX -> buffer containing saved state
  2051.  
  2052. Out:
  2053.   always successful
  2054.  
  2055. ------------------------------------------------------------------------------
  2056. ------------------------ End of PMODE/W Documentation ------------------------
  2057. ------------------------------------------------------------------------------
  2058.  
  2059.